-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fixed a bug where user status is not displayed on first load of a product #9288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the user's status currently loaded by the web app when viewing Channels? Are we loading it explicitly, or is it just being loaded by something else? While this is needed when viewing Boards or Playbooks, I want to make sure we're not duplicating requests made on load in Channels since we already make too many requests on load there
Funnily enough, I just found the code that loads the status currently, and it's kind of out of the way since it's loaded by the ResetStatusModal calling the Instead of doing that since it's rather out of the way, we should add status loading to |
Done. |
@@ -249,6 +249,7 @@ export function loadMe(): ActionFunc { | |||
const user = getState().entities.users.profiles[currentUserId]; | |||
if (currentUserId) { | |||
Client4.setUserId(currentUserId); | |||
await dispatch(getStatus(currentUserId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to wait for this to complete? Since we aren't able to fire off this request while we're loading everything else, perhaps we could just dispatch it without awaiting
on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we do need to wait for this. This is because the ResetStatusModal
component fetches the status only on the component mount (and not updated) and if the status is not found in the store, sets it to offline. Not awaiting here causes the status to always be displayed as offline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can do that since it'll make the first load longer. I think we either need to load the status asynchronously while the other stuff loads (like in the Promise.all
above) or we could make the modal handle the unloaded state properly
@harshilsharma63, what's the next step on this PR? Is there anything that can be done in the short term (e.g. refresh status after 200ms in Boards), if there are blocking issues on the full fix? |
Test server destroyed |
Removing my review request on this to clear out some notifications. Let me know when this is ready for my review again |
Summary
Currently, when you open Boards or Playbooks from Channels, your status is always displayed as offline in the global header.
This PR fixes that.
Ticket Link
mattermost-community/focalboard#1481
Related Pull Requests
None
Release Note